
package com.amigo.online.provider.manager.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.amigo.online.common.base.controller.BaseController;
import com.amigo.online.common.core.response.Response;
import com.amigo.online.provider.manager.model.entity.PromoteOrderTbl;
import com.amigo.online.provider.manager.model.entity.VideoPromoteTbl;
import com.amigo.online.provider.manager.result.OrderInfo;
import com.amigo.online.provider.manager.service.OrderService;

/**
 * <code>OrderController.java</code>
 * <p>
 *
 * </p>
 * <p>
 *
 * @author LuChen
 * @version 1.0
 * @company Amigo
 * @time 2018年12月3日 上午10:58:25
 * @lastUpdate 无
 * </p>
 */
@RestController
@RequestMapping(value = "/order", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class OrderController extends BaseController {

    @Autowired
    private OrderService orderService;

    @PostMapping("/getOrderList")
    public ResponseEntity<Response> getOrderList(@RequestBody PromoteOrderTbl order) {
        JSONObject re = orderService.getOrderList(order);
        return success(re);
    }

    @GetMapping("/getOrderInfo/{id}")
    public ResponseEntity<Response> getOrderInfo(@PathVariable("id") Long id) {
        OrderInfo re = orderService.getOrderInfo(id);
        return success(re);
    }

    public ResponseEntity<Response> getPromoteList(@RequestBody VideoPromoteTbl videoPromoteTbl) {
        JSONObject re = orderService.getPromoteList(videoPromoteTbl);
        return success(re);
    }

}

